package com.jxd.threaduntil;

import com.jxd.config.ApplicationContextRegister;
import com.jxd.config.HbaseConfig;
import com.jxd.hbase.analysis.FaultStatistics;
import com.jxd.hbase.analysis.SwitchCovers;
import org.apache.hadoop.hbase.client.Connection;
import org.springframework.web.context.WebApplicationContext;

import java.util.Date;

public class MaintainSwitchCoverss  implements Runnable{
    private String shipid;
    private String filename;
    private String mesid;
    private String xtid;

    public String getShipid() {
        return shipid;
    }

    public void setShipid(String shipid) {
        this.shipid = shipid;
    }

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public String getMesid() {
        return mesid;
    }

    public void setMesid(String mesid) {
        this.mesid = mesid;
    }

    public String getXtid() {
        return xtid;
    }

    public void setXtid(String xtid) {
        this.xtid = xtid;
    }

    @Override
    public void run() {
        System.out.println(mesid+"线程开始");
        long st = new Date().getTime();
        System.out.println(mesid+"开始时间"+st);
        WebApplicationContext ctx = (WebApplicationContext) ApplicationContextRegister.getApplicationContext();
        SwitchCovers switchCovers =(SwitchCovers)ctx.getBean(SwitchCovers.class);
        HbaseConfig hbaseConfig =(HbaseConfig)ctx.getBean(HbaseConfig.class);
        System.out.println("获取hbase"+mesid);
        Connection connection = hbaseConfig.HbaseConnection();
        System.out.println("执行hbase"+mesid);
        switchCovers.qurryMaintainSwitchCoverss(filename,shipid,mesid , xtid, connection);
        System.out.println(mesid+"连接关闭");
        System.out.println(mesid+"执行完毕");
        long end = new Date().getTime();
        System.out.println(mesid+"结束时间"+end);
        System.out.println(mesid+"所用时间"+(end-st));
    }
}
